#pragma once
#include <QtOpenGL/QGLWidget>
#include <glm/glm.hpp>
#include <string>
#include "Shader.h"
#include "Model.h"
#include "Camera.h"
#include "KDInter.h"
#include <thread>
#include <fstream>
#include "Line.h"

namespace mgl{

struct KDWidget : QGLWidget{
	KDWidget(int width, int height, QWidget* parent = nullptr);
	~KDWidget();

private:
	void initializeGL();
	void resizeGL(int w, int h);
	void paintGL();

	void keyPressEvent(QKeyEvent * event);
	bool m_needRefresh;

	Camera					m_camera;

	Shader					m_entityShader;
	Model					m_model;

	Shader					m_cubeShader;
	std::vector<KDInter>	m_kdInters;
	Line					m_line;

	float m_moveSpeed;
	float m_rotateSpeed;

	uint m_vao;

	std::ifstream			m_ifs;
	uint					m_step;

};

}